home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / vbasic / receipt.exe / RECIEPT1.BAS < prev    next >
BASIC Source File  |  1993-07-22  |  3KB  |  116 lines

  1. Sub CalcTotals ()
  2.    
  3.    Dim SubTotal As Double
  4.    Dim Tax As Double
  5.    Dim Freight As Double
  6.    Dim GrandTotal As Double
  7.    Dim Deposit As Double
  8.    Dim Balance As Double
  9.  
  10.    For i% = 1 To NumItems     ' Calc Ext's
  11.       Form2.Grid1.Col = 0
  12.       Form2.Grid1.Row = i%
  13.       Qty = Val(Form2.Grid1.text)
  14.       Form2.Grid1.Col = 4
  15.       Price = Val(Form2.Grid1.text)
  16.       Form2.Grid1.Col = 5
  17.       Form2.Grid1.text = Format$(Qty * Price, "####.00")
  18.    Next i%
  19.  
  20.    SubTotal = 0               ' Calc SubTotal
  21.    For i% = 1 To NumItems
  22.       Form2.Grid1.Row = i%
  23.       SubTotal = SubTotal + Val(Form2.Grid1.text)
  24.    Next i%
  25.  
  26.    Tax = SubTotal * SalesTax  ' Calc Sales Tax
  27.  
  28.    Form2.Grid2.Col = 1
  29.    Form2.Grid2.Row = 2
  30.    Freight = Val(Form2.Grid2.text)
  31.  
  32.    GrandTotal = SubTotal + Tax + Freight
  33.    Form2.Grid2.Row = 4
  34.    Deposit = Val(Form2.Grid2.text)
  35.    Balance = GrandTotal - Deposit
  36.  
  37.  
  38.    Form2.Grid2.Row = 0
  39.    Form2.Grid2.text = Format$(SubTotal, "$####.00")
  40.    Form2.Grid2.Row = 1
  41.    Form2.Grid2.text = Format$(Tax, "$####.00")
  42.    Form2.Grid2.Row = 3
  43.    Form2.Grid2.text = Format$(GrandTotal, "$####.00")
  44.    Form2.Grid2.Row = 5
  45.    Form2.Grid2.text = Format$(Balance, "$####.00")
  46.  
  47. End Sub
  48.  
  49. Function CheckDate% (Src As Control)
  50.    
  51.    Flag = 0
  52.    Mnth% = Val(Mid$(Src.text, 1, 2))
  53.    Daye% = Val(Mid$(Src.text, 4, 2))
  54.    yr% = Val(Mid$(Src.text, 7, 2))
  55.  
  56.    If Mnth% < 1 Or Mnth% > 12 Then Flag = -1
  57.    If Daye% < 1 Or Daye% > 31 Then Flag = -1
  58.    If yr% < 0 Or yr% > 99 Then Flag = -1
  59.    
  60.    tmp$ = Mid$(Src.text, 3, 1)
  61.    
  62.    If tmp$ <> "/" And tmp$ <> "-" Then Flag = -1
  63.    tmp$ = Mid$(Src.text, 6, 1)
  64.    If tmp$ <> "/" And tmp$ <> "-" Then Flag = -1
  65.  
  66.    CheckDate% = Flag
  67.  
  68. End Function
  69.  
  70. Sub CompressItems ()
  71. ' this routine checks the Grid1 entries and if it
  72. ' finds an empty entry, will compress the listing
  73. ' to eliminate holes in the entries...
  74. End Sub
  75.  
  76. ' COPYRIGHT:
  77. '
  78. '   (C) Copyright Microsoft Corp. 1993.  All rights reserved.
  79. '
  80. '   You have a royalty-free right to use, modify, reproduce and
  81. '   distribute the Sample Files (and/or any modified version) in
  82. '   any way you find useful, provided that you agree that
  83. '   Microsoft has no warranty obligations or liability for any
  84. '   Sample Application Files which are modified.
  85. '
  86. Sub InitVars ()
  87.     Form1.VenName.text = ""
  88.     Form1.VenNo.text = ""
  89.     Form1.CalledIn.text = ""
  90.     Form1.OrderDate.text = "  /  /"
  91.     Form1.VenContact.text = ""
  92.     Form1.EstDate.text = "  /  /"
  93.     Form1.CustName.text = ""
  94.     Form1.CustAddr.text = ""
  95.     Form1.CustCity.text = ""
  96.     Form1.CustState.text = ""
  97.     Form1.CustZip.text = ""
  98.     Form1.HPhone.text = "(   )   -    "
  99.     Form1.WPhone.text = "(   )   -    "
  100.     Form1.ShipName.text = ""
  101.     Form1.ShipAddr.text = ""
  102.     Form1.ShipCity.text = ""
  103.     Form1.ShipState.text = ""
  104.     Form1.ShipZip.text = ""
  105.     Form1.ShipVia.text = ""
  106.     Form1.Terms.text = ""
  107.     NumItems = 0
  108.     Form1.OrderNo.text = LTrim$(Str$(Val(Form1.OrderNo.text) + 1))
  109.  
  110. End Sub
  111.  
  112. Sub SaveInfo ()
  113.  
  114. End Sub
  115.  
  116.